/**
 * @a https://leetcode.cn/problems/group-anagrams/
 */

#include "../common.h"

class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string, vector<string>> kv;
        for(auto tmp : strs){
            string origin = tmp;
            sort(tmp.begin(), tmp.end());
            kv[tmp].push_back(origin);
        }
        vector<vector<string>> ret;
        for(auto item : kv){
            ret.push_back(item.second);
        }
        return ret;
    }
};